<template>
  <div class="recommend">
    <h1>
      <span>爆款推荐</span>
    </h1>
    <ul>
      <li v-for="(item, index) in recommendList" :key="index">
        <h2>
          <img :src="item.imgUrl" alt="" />
        </h2>
        <div>
          <h3>{{ item.name }}</h3>
          <p>{{ item.content }}</p>
          <p class="price">
            <span>￥</span>
            {{ item.price }}
          </p>
        </div>
      </li>
    </ul>
  </div>
</template>

<script>
export default {
  data() {
    return {
      recommendList: [
        {
          id: 1,
          name: "龙井1号铁罐250g",
          content: "鲜爽甘醇",
          price: 299,
          imgUrl: "./images/recommend.jpeg",
        },
        {
          id: 2,
          name: "龙井1号铁罐250g",
          content: "鲜爽甘醇",
          price: 299,
          imgUrl: "./images/recommend.jpeg",
        },
      ],
    };
  },
};
</script>

<style lang="less" scoped>
.recommend {
  width: 100%;
  margin-top: 0.4267rem;
  background-color: #fff;
  h1 {
    text-align: center;
    padding: 0.4rem 0;
    font-size: 0.5rem;
    color: #333333;
    span {
      position: relative;
      display: inline-block;
      &::before {
        content: "";
        position: absolute;
        width: 0.2133rem;
        height: 0.2133rem;
        border-radius: 50%;
        display: block;
        background: #d4c0a7;
        top: 50%;
        left: -0.5rem;
        margin-top: -0.0533rem;
      }
      &::after {
        content: "";
        position: absolute;
        width: 0.2133rem;
        height: 0.2133rem;
        border-radius: 50%;
        display: block;
        background: #d4c0a7;
        top: 50%;
        right: -0.5rem;
        margin-top: -0.0533rem;
      }
    }
  }
  ul {
    li {
      text-align: center;
      img {
        width: 9.6rem;
        height: 3.84rem;
        border-radius: 0.32rem;
      }
      position: relative;
      div {
        position: absolute;
        right: 0;
        top: 0;
        display: flex;
        flex-direction: column;
        h3 {
          color: #666666;
          font-size: 0.34rem;
          padding: 1.0667rem 0.5333rem 0.1333rem 0;
        }
        p {
          overflow: hidden;
          text-overflow: ellipsis;
          display: -webkit-box;
          -webkit-line-clamp: 2;
          -webkit-box-orient: vertical;
          color: #333333;
          font-size: 0.4rem;
          span {
            font-size: 0.3733rem;
          }
          &:nth-child(3) {
            color: #b0352f;
            font-size: 0.5rem;
            font-weight: normal;
            margin-top: 0.4267rem;
          }
        }
      }
    }
  }
}
</style>